/**
 * Created by administrator on 2/21/14.
 */
public class Diamond {

    // what do you need to know to construct
    // one level of a isosceles?
    // answer:  N for total height, and the ith layer

    void print_one() {
        System.out.print('*');
    }

    void print_spaces(int n) {
        int x = 0;
        while (x < n) {
            System.out.print(' ');
            x++;
        }
    }

    void print_horizontal(int n) {
        int x = 0;
        while (x < n) {
            print_one();
            x++;
        }
        System.out.println();
    }

    void print_isosceles(int n){
        int x = 0;
        while (x < n) {
            print_spaces(n-x);
            print_horizontal(x*2 + 1);
            x++;
        }
    }

    void print_upsidedown_isosceles(int n) {
        int x = n - 2;
        while (x >= 0) {
            print_spaces(n-x);
            print_horizontal(x*2 +1);
            x--;
        }
    }

    void print_diamond(int n) {
        print_isosceles(n);
        print_upsidedown_isosceles(n);
    }

    void print_short_isosceles(int n) {
        int x = 0;
        while (x < n-1) {
            print_spaces(n-x);
            print_horizontal(x*2 + 1);
            x++;
        }
    }

    public void print_diamond_with_name(int n, String name) {
        print_short_isosceles(n);
        System.out.println(name);
        print_upsidedown_isosceles(n);
        //System.out.print("hooray!" + n + name);
    }

}